<?php

namespace App\Console\Commands;

use App\Models\User;
use Illuminate\Console\Command;

class CacheUserLikeCategory extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'book:cache-user-like-category';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '缓存用户喜欢的分类推荐';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle(User $user)
    {
        $this->info("开始缓存...");
        $user->setAllUserLikeCategories();
        $this->info("成功缓存...");
    }
}
